package com.ryskoo.basicdata.area.region.service;

import com.ryskoo.basicdata.area.region.domain.RegionPO;
import com.ryskoo.basicdata.area.region.repository.IRegionRepository;
import com.ryskoo.framework.core.service.BasicServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author qyc
 */
@Service
public class RegionServiceImpl extends BasicServiceImpl<RegionPO> implements IRegionService {
    @Autowired
    private IRegionRepository regionRepository;

    @PostConstruct
    public void init() {
        this.setDao(regionRepository);
    }

	@Override
	public List<RegionPO> getRegionsByCityId(String cityId) {
		if(StringUtils.isBlank(cityId)){
			return null;
		}
		return regionRepository.getRegionsByCityId(cityId);
	}

	@Override
	public RegionPO getByEntityNo(String entityNo) {
		return regionRepository.getByEntityNo(entityNo);
	}
}
